package com.aaa.project2;

public class Meth {
    /*排序*/
    public static void  sort(int [] arr){
        for (int i = 1; i < arr.length; i++) {
            for(int j=0;j< arr.length-i;j++){
                if(arr[j]>arr[j+1]){
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
    }
    /*最大值*/
    public static  int Max(int [] arr){
        int temp =arr[0];
        for (int i = 0; i < arr.length ; i++) {
            if (temp<arr[i]){
                temp=arr[i];
            }
        }
        return temp;
    }
    /*索引*/
    public static  int indexOff(int [] arr,int a){
        for (int i = 0; i < arr.length ; i++) {
            if (a == arr[i]) {
                return i;
            }
        }
        return -1;
    }
    /*字符串拼接*/
    public  static  String MyString(int [] arr){
        String str="[";
        for (int i = 0; i < arr.length ; i++) {
            str+=arr[i];
            if (i < arr.length-1) {
                str+=",";
            }else {
                str+="]";
            }
        }
                return str;
    }
    /*判断支付串是否一致*/
    public static String yizi(int [] arr,int [] arr1){
        if (arr.length !=arr1.length) {
            return "不一致";
        }
        for (int i = 0; i < arr.length ; i++) {
            if (arr[i] != arr1[i]) {
                return "不一致";
            }
        }
        return "一致";
    }
}
